package io.renren.modules.combat.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.combat.dao.TFightDictionaryDao;
import io.renren.modules.combat.entity.TFightDictionaryEntity;
import io.renren.modules.combat.service.TFightDictionaryService;


@Service("tFightDictionaryService")
public class TFightDictionaryServiceImpl extends ServiceImpl<TFightDictionaryDao, TFightDictionaryEntity> implements TFightDictionaryService {

    @Autowired
    private TFightDictionaryDao tFightDictionaryDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String typeName = (String)params.get("typeName");
        IPage<TFightDictionaryEntity> page = this.page(
                new Query<TFightDictionaryEntity>().getPage(params),
                new QueryWrapper<TFightDictionaryEntity>().notIn("type","8888")
                        .like(StringUtils.isNotBlank(typeName),"type_name", typeName).orderByDesc("id")
        );

        return new PageUtils(page);


    }
    /**
     * 统计 战斗类型
     * @return
     */
    public List<TFightDictionaryEntity> getTFightDictionaryEntity(){
        return tFightDictionaryDao.getTFightDictionaryEntity();
    }

}